﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:s="clr-namespace:MockupDesigner.AppItems"
                    xmlns:c="clr-namespace:MockupDesigner.Items"
                    xmlns:SketchControls="clr-namespace:Microsoft.Expression.Prototyping.SketchControls;assembly=Microsoft.Expression.Prototyping.SketchControls"
                    xmlns:ps="clr-namespace:Microsoft.Expression.Prototyping.SketchControls;assembly=Microsoft.Expression.Prototyping.SketchControls" 
                    xmlns:wpfToolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
                    xmlns:ac="clr-namespace:MockupDesigner.AdditionalControls">

    <!-- Control Templates For Items-->
    <ControlTemplate x:Key="NoteItemTemplate" TargetType="{x:Type c:NoteItem}">
        <ContentControl >
            <ContentControl.Content>
                <Grid>
                    <Path Stretch="Fill" Stroke="{DynamicResource BaseBorder-Sketch}" StrokeThickness="2" HorizontalAlignment="Left" Margin="0,5,0,0"
	Data="M253,301 L142.5,301 142.5,180.5 281.5,180.5 281.5,301 253,301 " VerticalAlignment="Top" >
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                <GradientStop Color="LightYellow" Offset="0" />
                                <GradientStop Color="Yellow" Offset="0.75" />
                            </LinearGradientBrush>
                        </Path.Fill>
                        <Path.BitmapEffect>
                            <DropShadowBitmapEffect Color="Black" Direction="320" ShadowDepth="10" Softness="1" Opacity="0.5"/>
                        </Path.BitmapEffect>
                    </Path>
                    <Rectangle HorizontalAlignment="Center" VerticalAlignment="Top"  Fill="Red" Stroke="{DynamicResource BaseBorder-Sketch}" StrokeThickness="2" Height="25" Width="75" />
                    <Label
                        HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,28,0,0"
                        Content="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:NoteItem}}}"
                        Style="{DynamicResource SimpleLabelStyle}"  />
                </Grid>
            </ContentControl.Content>
        </ContentControl>
    </ControlTemplate>

    <ControlTemplate x:Key="ButtonItemTemplate" TargetType="{x:Type c:ButtonItem}">
        <Label Content="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:ButtonItem}}}" 
            Style="{DynamicResource ButtonStyle}"  />
    </ControlTemplate>

    <ControlTemplate x:Key="ImageItemTemplate" TargetType="{x:Type c:ImageItem}">
        <Image Source="{Binding Path=Source, RelativeSource={RelativeSource AncestorType={x:Type c:ImageItem}}}" Stretch="Fill" />
    </ControlTemplate>
    <ControlTemplate x:Key="ComboBoxItemTemplate" TargetType="{x:Type c:ComboBoxItem}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <ComboBox Grid.Row="0" 
                SelectedIndex="{Binding Path=SelectedIndex, RelativeSource={RelativeSource AncestorType={x:Type c:ComboBoxItem}}}"
                ItemsSource="{Binding Path=Items, RelativeSource={RelativeSource AncestorType={x:Type c:ComboBoxItem}}}"
                Style="{DynamicResource ComboBox-Sketch}">
            </ComboBox>
            <Label x:Name="List" Grid.Row="1"  Visibility="{Binding Path=ListVisibility, RelativeSource={RelativeSource AncestorType={x:Type c:ComboBoxItem}}}"
                Content="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:ComboBoxItem}}}"
                Style="{DynamicResource ListStyle}" />
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="CheckBoxItemTemplate" TargetType="{x:Type c:CheckBoxRadioButtonItem}">
        <CheckBox 
            Content="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:CheckBoxRadioButtonItem}}}" 
            FlowDirection="{Binding Path=FlowDirection, RelativeSource={RelativeSource AncestorType={x:Type c:CheckBoxRadioButtonItem}}}" 
            IsChecked="{Binding Path=Checked, RelativeSource={RelativeSource AncestorType={x:Type c:CheckBoxRadioButtonItem}}}" 
            Style="{DynamicResource CheckBoxStyle}" />
    </ControlTemplate>
    <ControlTemplate x:Key="HyperlinkItemTemplate" TargetType="{x:Type c:HyperlinkItem}">
        <TextBlock 
            Text="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:HyperlinkItem}}}"
            Style="{DynamicResource TextBlockStyle}"/>
    </ControlTemplate>
    <ControlTemplate x:Key="LabelItemTemplate" TargetType="{x:Type c:LabelItem}">
        <Label 
            Content="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:LabelItem}}}" 
            Style="{DynamicResource SimpleLabelStyle}"  />
    </ControlTemplate>
    <ControlTemplate x:Key="ListBoxItemTemplate" TargetType="{x:Type c:ListBoxItem}">
        <ListBox HorizontalAlignment="Left" VerticalAlignment="Top" Height="{Binding Path=Height, RelativeSource={RelativeSource AncestorType={x:Type c:ListBoxItem}}}" Width="{Binding Path=Width, RelativeSource={RelativeSource AncestorType={x:Type c:ListBoxItem}}}"
            ItemsSource="{Binding Path=ItemsSource, RelativeSource={RelativeSource AncestorType={x:Type c:ListBoxItem}}}"
            Style="{DynamicResource ListBox-Sketch}" >
        </ListBox>
    </ControlTemplate>
    <ControlTemplate x:Key="ProgressBarItemTemplate" TargetType="{x:Type c:ProgressBarItem}">
        <ProgressBar  
            Value="{Binding Path=Value, RelativeSource={RelativeSource AncestorType={x:Type c:ProgressBarItem}}}"
            Orientation="{Binding Path=Orientation, RelativeSource={RelativeSource AncestorType={x:Type c:ProgressBarItem}}}"
            Style="{DynamicResource ProgressBar-Sketch}"/>
    </ControlTemplate>
    <ControlTemplate x:Key="RadioButtonItemTemplate" TargetType="{x:Type c:CheckBoxRadioButtonItem}">
        <RadioButton
            Content="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:CheckBoxRadioButtonItem}}}"
            FlowDirection="{Binding Path=FlowDirection, RelativeSource={RelativeSource AncestorType={x:Type c:CheckBoxRadioButtonItem}}}" 
            IsChecked="{Binding Path=Checked, RelativeSource={RelativeSource AncestorType={x:Type c:CheckBoxRadioButtonItem}}}" 
            Style="{DynamicResource RadioButtonStyle}" />
    </ControlTemplate>
    <ControlTemplate x:Key="TextBoxItemTemplate" TargetType="{x:Type c:TextBoxItem}">
        <TextBox 
            Text="{Binding Path=Text, RelativeSource={RelativeSource AncestorType={x:Type c:TextBoxItem}}}" 
            AcceptsReturn="{Binding Path=Multiline, RelativeSource={RelativeSource AncestorType={x:Type c:TextBoxItem}}}"
            Style="{DynamicResource TextBox-Sketch}"  />
    </ControlTemplate>


    <!-- ToolBox -->
    <s:Toolbox x:Key="CommonToolbox">
        <c:NoteItem ToolTip="Note" IsHitTestVisible="False" 
            Height="30" Width="80" 
            Text="Taper une note ici" 
            Template="{DynamicResource NoteItemTemplate}"  />
        <c:ImageItem ToolTip="Image" IsHitTestVisible="False" 
            Height="80" Width="80" 
                     Source="/Resources/Images/NoImage.png"
            Template="{DynamicResource ImageItemTemplate}" />
        <c:ButtonItem ToolTip="Button" IsHitTestVisible="False" 
            Height="30" Width="80" 
            Text="Button" 
            Template="{DynamicResource ButtonItemTemplate}"  />
        <c:CalendarItem ToolTip="Calendar" Height="50" Width="50" >
            <Viewbox Stretch="Fill" >
                <wpfToolkit:Calendar Style="{DynamicResource CalendarStyle}" DisplayDate="01/01/2000" SelectedDate="01/01/2000" />
            </Viewbox>
        </c:CalendarItem>
        <c:CheckBoxRadioButtonItem ToolTip="CheckBox" IsHitTestVisible="False" 
            Height="25"
            Text="CheckBox" 
            FlowDirection="LeftToRight" 
            Template="{DynamicResource CheckBoxItemTemplate}"/>
        <c:ComboBoxItem ToolTip="ComboBox" IsHitTestVisible="False"
            Height="30" 
            SelectedIndex="0"
            Template="{DynamicResource ComboBoxItemTemplate}"/>
        <c:HyperlinkItem ToolTip="Hyperlink" IsHitTestVisible="False"
            Height="25"             
            Text="Hyperlink"
            Template="{DynamicResource HyperlinkItemTemplate}" />
        <c:LabelItem ToolTip="Label" IsHitTestVisible="False"
            Height="25"
            Text="Label"
            Template="{DynamicResource LabelItemTemplate}" />
        <c:ListBoxItem ToolTip="ListBox" IsHitTestVisible="False" 
            Template="{DynamicResource ListBoxItemTemplate}"/>
        <c:NumericUpDownItem ToolTip="NumericUpDown" IsHitTestVisible="False"
                        Height="30">
            <ac:NumericUpDown 
                Maximum="10000" Minimum="-10000"
                Template="{DynamicResource NumericUpDownDefaultTemplate}" />
        </c:NumericUpDownItem>
        <c:ProgressBarItem ToolTip="ProgressBar" IsHitTestVisible="False" 
            Height="25" Width="100"
            Value="20"
            Orientation="Horizontal"
            Template="{DynamicResource ProgressBarItemTemplate}"/>
        <c:CheckBoxRadioButtonItem ToolTip="RadioButton" IsHitTestVisible="False" 
            Height="25"
            Text="RadioButton" 
            FlowDirection="LeftToRight" 
            Template="{DynamicResource RadioButtonItemTemplate}"/>
        <c:TextBoxItem ToolTip="TextBox" IsHitTestVisible="False" 
            Text="TextBox" 
            Height="25" 
            Template="{DynamicResource TextBoxItemTemplate}"/>
    </s:Toolbox>
</ResourceDictionary>